#ifndef mystdio
#define mystdio

//#include "sheet.h"

#define VIDEO_ADDRESS 0xb8000
#define MAX_ROWS 25
#define MAX_COLS 80
#define WHITE_ON_BLACK 0x0f
#define RED_ON_WHITE 0xf4
//#define VIDEO_MEM    0xa0000
#define ADR_BOOTINFO    0x90010 //0x00000ff0
//#define BINFO_ADDRESS 0xff0
#define BLACK 0 
#define RED 1 
#define GREEN 2 
#define YELLOW 3 
#define BLUE 4 
#define PURPLE 5 
#define LIGHTBLUE  6 
#define WHITE 7 
#define LIGHTGREY 8 
#define DARKRED 9 
#define DARKGREEN 10
#define DARKYELLOW 11
#define DARKBLUE 12
#define DARKPURPLE 13
#define LIGHTDARKBLUE 14
#define DARKGREY 15

/* Screen i/o ports */
#define REG_SCREEN_CTRL 0x3d4
#define REG_SCREEN_DATA 0x3d5

/* structure for screen related info */
struct BOOTINFO {
    // all variables are of 8 bits. Order cares.
    //char cyls, leds, vmode, reserve;
    unsigned short vmode, xsize, ysize;
    //unsigned char *vram;
};


/* Public kernel API */
void clear_screen(void);
void init_fstdio(int xsize, int ysize);
void init_palette(void);
void boxfill8(unsigned char* vram, int xsize, int ysize, unsigned char c, int x0, int y0, int x1, int y1);
void putfont8(unsigned char* vram, int xsize, int x, int y, char color, unsigned char c);
void putfont8bck(unsigned char* vram, int xsize, int ysize, int px0, int py0, 
int px1, int py1, unsigned char color, unsigned char bck, unsigned c);
void putfonts8_asc(unsigned char* vram, int xsize, int x, int y, char c, unsigned char *s);
//void putfonts8_asc_sht(struct SHEET *sht, int x, int y, int c, char *s, int l);
void init_screen(int xsize, int ysize);
int mysprint_long(unsigned char *s, long num);
int int_to_ascii(int n, char str[]);
int uint_to_ascii(unsigned int n, char str[]);
int int_to_hex(int n, char str[]);
int uint_to_hex(unsigned int n, char str[]);
int longlong_to_hex(long long n, char str[]);
void putblock8_8(unsigned char* vram, int vxsize, int pxsize,
        int pysize, int px0, int py0, char *buf, int bxsize);
void putblock8x8(unsigned char* vram, int vxsize, int pxsize, int pysize, int px0, int py0, char *buf, int bxsize);
void printstr(int row, int col, int len, unsigned char *str);
void make_window8(unsigned char *buf, int xsize, int ysize, char *title);

void writem8(unsigned char *vram, int pos, unsigned char c);
unsigned char readm8(unsigned char *vram, int pos);

void write_mem8(int addr, int data);
char read_mem8(int addr);
#endif

